# Contributor: Nathan Johnson <nathan@nathanjohnson.info>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-couchbase
_extname=couchbase
pkgver=4.1.6
pkgrel=0
pkgdesc="PHP 8.1 extension for Couchbase - PECL"
url="https://pecl.php.net/package/couchbase"
arch="all !riscv64" # ftbfs
license="Apache-2.0"
_phpv=81
_php=php$_phpv
depends="$_php-pecl-igbinary"
makedepends="$_php-dev openssl-dev>3 linux-headers cmake chrpath"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz
	fix-lfs64.patch
	"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	# no tests shipped via PECL
	$_php -d extension="$builddir"/modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	chrpath -r "/usr/lib/$_php/modules" "$pkgdir"/usr/lib/$_php/modules/$_extname.so
	chrpath -d "$pkgdir"/usr/lib/$_php/modules/libcouchbase_php_wrapper.so

	local _confdir="$pkgdir"/etc/$_php/conf.d
	mkdir -p $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
ef031bc705628d7ec94d86fcd05f21e5322b446663d091c093e9dcb4ce28766a77cc257ad0cfbb70ebbebbee364aa44ba1326d00087671be5789d979b22784ae  php-pecl-couchbase-4.1.6.tgz
f2bd5a4348e4e37e96b1e84d67f89d9f0e29b548e14815013fb6e56803a0bfaec3542b29a4c001629a185916412cae2a05c96a231f8a4786aaeca9faada88d13  fix-lfs64.patch
"
